# -*- coding: utf8 -*-
'''
https://github.com/randomInteger/producer_consumer/blob/master/multi_fifo_queue.py

https://www.cnblogs.com/cindy-cindy/p/8031731.html

This is a very straightforward example of how the amazing Queue() class can
make it extremely easy to write straightforward, idiomatic Python3 code to
solve the producer-consumer problem with multiple threads working on the same
queue.
Compare this to the fifo_queue.py version and see how much more we can do with
less code when we use Queue().
Author:  c.gleeson May 2018
'''

class Alarm(object):
#{time};{clientip};{serverip};{method};{url};{rule};{level};{act};
    def __init__(self, time, sip, dip, method, url, rule, level, act, hitcount = 1):
        #get current ticks, unit: seconds
        self.ticks = int(time)
        self.sip = sip
        self.dip = dip
        self.method = method
        self.url = url
        self.rule = rule
        self.level = level
        self.act = act
        self.hitcount = hitcount
    def tuplesig(self):
        return self.sip+self.dip+self.rule
    def __str__(self):
        return "%s;%s;%s;%s;%s;%s;%s;%s;%d" %(self.ticks, self.sip, self.dip, self.method, self.url, self.rule, self.level, self.act, self.hitcount)
    def set_time(self, tm):
        self.ticks = tm

if __name__ == '__main__':
    pass
